<script lang="ts" setup>
  import { ref } from "vue"
  import { examine } from "@/api/franchisee"
  import { type FormRules, ElMessage } from "element-plus"

  interface Props {
    data?: any
    title?: string
  }

  const props = withDefaults(defineProps<Props>(), {
    data: ()=>({}),
    title: ""
  })

  const form = ref<any>({})
  const formRef = ref<any>()
  const emit = defineEmits(['cancel','success'])
  const loading = ref(false)
  const rules: FormRules = {
    isPass: [
      { required: true, message: '请选择审核结果', trigger: 'change' },
    ],
    reason: [
      { required: true, message: '请输入审核意见', trigger: 'change' },
    ],
  }
  const showDrawer = ref(true)
  const cancel = ()=>{
    emit('cancel')
  }

  const success =  async()=>{
    await formRef.value?.validate((valid: any) => {
      if (!valid) {
        return
      }
      examine({...form.value,id: props.data.franchiseeApplyRecordId}).then(()=>{
         ElMessage({
            message: '操作成功',
            type: 'success',
          })
        emit('success')
      }).catch(()=>{

      })
    })
  }
</script>

<template>
  <el-drawer
      v-model="showDrawer"
      :title="props.title"
      @close="cancel"
      size="800px"
      direction="rtl"
    >
      <div class="fieldTable">
        <el-form label-width="100px" label-position="left">
            <el-row :gutter="20" class="form-card-main">
              <el-col :span="12">
                <el-form-item label="费用所属月">{{data.month}}</el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="请款金额">{{data.requestPayPrice}}</el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="请款日期">{{data.requestPayTime}}</el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item label="开票金额">{{data.startShootingPrice}}</el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="开票日期">{{data.startShootingTime}}</el-form-item>
              </el-col>

              <el-col :span="12">
                <el-form-item label="付款金额">{{data.requestPayPrice}}</el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="付款日期">{{data.payTime}}</el-form-item>
              </el-col>


             
            </el-row>

          </el-form>
        </div>
      </el-drawer>
</template>


<style lang="scss" scoped>

</style>
